# coding: utf-8

class Term < ActiveRecord::Base
  paginates_per 20

  scope :sorted, order('name ASC')
  scope :last, order('created_at DESC')

  validates :name, :presence => true,
            :uniqueness => {:case_sensitive => false},
            :length     => {:within => 2..60}
  validates :value, :presence => true,
            :length     => {:minimum => 10}

  def self.chars
    [(0..9), ("А".."Я"), ("A".."Z")].map {|i| i.to_a}
  end
end
